<?php

/**
 * @author Samrat Khan & Sadik Sarfaraz - 9:10:10 AM Jul 1, 2013 
 */
require('top.inc.php');
if(isset($_SESSION['user']) && $_SESSION['user']['utype'] == 1 || $_SESSION['user']['utype'] == 2 || $_SESSION['user']['utype'] == 3 || $_SESSION['user']['utype'] == 4) {
    $sess_cusID = $_SESSION['user']['cus_id'];
    
    $pages = new Paginator(' 50', 'page');
    //$total = getCountA('stockin', 'stockin_id', 'cus_id', $sess_cusID, $db);
    $rows1 = theSummary($db);
    
    echo '<div class="fixedleftBox">';
        echo "<input class=\"btn btn-primary\" type=\"button\" onclick=\"tableToExcel('stockinhanddiv', 'Movement History')\" value=\"Export to excel of present stockin hand\">";
    echo '</div>';
    
    echo "<table id=\"stockinhanddiv\" class=\"row-fluid table table-striped table-bordered\">";
            echo "<tr>";
                echo "<th>". "Product ID" ."</th>";
                echo "<th>". "Description" ."</th>";
                echo "<th>". "InQty" ."</th>";
                echo "<th>". "OutQty" ."</th>";
                echo "<th>". "Total In Hand" ."</th>";
                echo "<th>". "Barisal EBL" ."</th>";
                echo "<th>". "Bogra EBL" ."</th>";
                echo "<th>". "Chittagong EBL" ."</th>";
                echo "<th>". "Comilla EBL" ."</th>";
                echo "<th>". "Cox's Bazar EBL" ."</th>";
                echo "<th>". "Dhaka EBL" ."</th>";
                echo "<th>". "Dinajpur EBL" ."</th>";
                echo "<th>". "Jessore EBL" ."</th>";
                echo "<th>". "Khulna EBL" ."</th>";
                echo "<th>". "Mymensing EBL" ."</th>";
                echo "<th>". "Noakhali EBL" ."</th>";
                echo "<th>". "Sylhet EBL" ."</th>";
            echo "</tr>";
        foreach ($rows1 as $row) {
            echo "<tr>";
                echo "<td>". $row['productid'] ."</td>";
                echo "<td>". $row['description'] ."</td>";
                echo "<td>". $row['InQty'] ."</td>";
                echo "<td>". $row['OutQty'] ."</td>";
                echo "<td>". $row['Total'] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                echo "<td>". $row[''] ."</td>";
                
            echo "</tr>";
        }
    echo "<table>";
} else {
    header("Location: login.php");
}
include ('bottom.inc.php');
?>